package com.doubledragon.tiny.aop.daynamicProxy;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * Created by dragon
 *
 * MethodInterceptor extends Advice
 * MethodInterceptor 这个接口就继承自 Advice, 代表一个方法拦截器!!!
 */
public class MethodInterceptorOfHelloWorld implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        System.out.println("在被拦截的方法之前打印");
        Object invoke = invocation.proceed();//调用原始方法
        System.out.println("在被拦截的方法之后打印");
        return invoke;
    }
}
